package com.jemmyee.core.dao;

import java.io.Serializable;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

/**
 * @author jemmyee
 * @date 2010-7-12
 * @param <T>
 */
public interface IBaseDao<T> {
	
	public void save(T entity);
	
	public void delete(T entity);
	
	public void deleteById(Serializable id);
	
	public void update(T entity);

	public T findById(Serializable id);
	
	public List<T> findByProperty(T entity, String propertyName, Object value);
	
	public List<T> findAll(T entity);

	/**
	* @Description: 条件查询，不分页
	* @author:jemmyee@gmail.com
	* @date:2010-11-8
	*/
	public List<T> findByCriteria(final DetachedCriteria criteria);
	
	/**
	 * 分页查询
	 * @param detachedCriteria
	 * @param pageSize
	 * @param startIndex
	 * @return
	 */
	public Page findPageByCriteria(final DetachedCriteria detachedCriteria,
			final int pageSize, final int startIndex,final String order);
	
	public void deleteAll(List<T> list);
}
